home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
program
/
cuj0796.zip
/
COLNER.ZIP
/
STRCLASS.H
< prev
next >
Wrap
C/C++ Source or Header
|
1996-05-08
|
2KB
|
68 lines
#if !defined(STRINGCLASS_DEFINED)
#define STRINGCLASS_DEFINED
#include <strstrea.h>
#include <string.h>
/************************ Pause *****************************
To force a pause() at exit, include:
Pause::init(argc, argv);
at the beginning of main(), and include "-pause"
as a command line arguement.
*/
class
Pause{
static char *programName;
static int noPause;
friend ostream& operator<<(ostream& out, Pause& pause);
friend void pause();
public:
static void init(int argc, char *argv[]);
};
//************************ String *****************************
// ostream& operator <<(ostream& out, Pause& pause);
#define MESSAGE(s) message(#s,__LINE__,__FILE__,__DATE__)
#define ASSERT(s) if((s)==NULL){ \
MESSAGE(s); \
exit(1); \
}
extern void message( char* code, unsigned long line, char* file, char* date);
#define CAST_INJECTORS(CLASS) \
CLASS& operator<< (char _c) { \
(ostrstream&)*this << _c; return *this; } \
CLASS& operator<< (signed char _c) { \
(ostrstream&)*this << _c; return *this; } \
CLASS& operator<< (unsigned char _c) { \
(ostrstream&)*this << _c; return *this; } \
CLASS& operator<< (const char * s){ \
(ostrstream&)*this << s; return *this; } \
CLASS& operator<< (const signed char * s){ \
(ostrstream&)*this << s; return *this; } \
CLASS& operator<< (const unsigned char * s){ \
(ostrstream&)*this << s; return *this; } \
CLASS& operator<< (short _i){ \
(ostrstream&)*this << _i; return *this; } \
CLASS& operator<< (unsigned short _i){ \
(ostrstream&)*this << _i; return *this; } \
CLASS& operator<< (int _i){ \
(ostrstream&)*this << _i; return *this; } \
CLASS& operator<< (unsigned int _i){ \
(ostrstream&)*this << _i; return *this; } \
CLASS& operator<< (long _i){ \
(ostrstream&)*this << _i; return *this; } \
CLASS& operator<< (unsigned long _i){ \
(ostrstream&)*this << _i; return *this; } \
CLASS& operator<< (float _i){ \
(ostrstream&)*this << _i; return *this; } \
CLASS& operator<< (double _i){ \
(ostrstream&)*this << _i; return *this; } \
CLASS& endl(){ \
::endl((ostream&)*this); return *this; } \
CLASS& operator<< (ostream& (*_f)(ostream&)){ \
(*_f)((ostream&)*this); return *this; } \
CLASS& operator<< (ios& (*_f)(ios&)) { \
(*_f)((ios&)*this); return *this; } \
CLASS& operator << ( String& s ){ \
(ostrstream&)*this << s; return *this; }